import string
import os
import calendar, time
from dateutil import tz
from datetime import datetime
import xlrd
folder = '/home/dheinzerling/BSG/bsg on 169.229.130.74/!Projects/HVAC/UFAD/NSA - 2012 (restricted permissions)/Data/HOBO/Strings/old/'
#for filename in os.listdir(folder):
#    print filename[:7]
    #print os.path.splitext(filename[5:])[1]
#f = open('/home/dheinzerling/BSG/bsg on 169.229.130.74/!Projects/HVAC/UFAD/NSA - 2012 (restricted permissions)/Data/HOBO/Strings/old/586415.csv', 'rb')
#dataName = filename[:6]
#data = {}
#dataName = '586415'
#data[dataName] = f.readlines()
#heights = data[dataName][1].split(',')
#print heights
#print str(int(round(float(heights[2]),0)))

#f = xlrd.open_workbook('/home/dheinzerling/BSG/bsg on 169.229.130.74/!Projects/HVAC/UFAD/NSA - 2012/Data/HOBO/Plenum/new xlsx/1033900.xlsx')
#time_zone_utc = tz.gettz('UTC')
time_zone = tz.gettz('America/New_York')
#f = open('/home/cbe/BSG_share/bsg on 169.229.130.74/!Projects/IEQ/Monitoring/WSPFK - 2012/Data/Trends/5th Floor UFTs/5A-01SupplyAirTemp.rtf', 'rb')
#data = f.sheet_by_index(0)
#print len(data.col_values(0)[1:])
#dates = data.col_values(1)[1:]
#times = data.col_values(2)[2:]
#print dates
#print xlrd.xldate_as_tuple(dates[5] + times[5],f.datemode)
#print datetime(*xlrd.xldate_as_tuple(dates[5] + times[5],f.datemode)[:6]).replace(tzinfo = time_zone)
#print calendar.timegm(xlrd.xldate_as_tuple(dates[5] + times[5],f.datemode).)
#print times[:5]
#for i in xrange(len(dates)):
#    print dates[i]+' '+times[i]
new_date = datetime.strptime('10/01/12 13:00:00', '%m/%d/%y %H:%M:%S').replace(tzinfo = time_zone)
print new_date
print calendar.timegm(new_date.utctimetuple())
#dttime = line[1]
#print line
#print line[1]
#print calendar.timegm(time.strptime(dttime, '%m/%d/%Y %H:%M')) + 3600*7
#new_date = datetime.strptime(dttime, '%m/%d/%Y %H:%M').replace(tzinfo = time_zone)
#print new_date.astimezone(time_zone_utc)

#d = {}
#d['a'] = [5,6]
#d['b'] = [6,7]
#for data in d:
#    print d[data]

test = '/nsa/1002_temp'
name = test.split('/')[2]
print name.split('_')[0]